package cn.ilovese.collect.po.user;

import cn.ilovese.collect.vo.transaction.TransactionDetailVO;
import cn.ilovese.collect.vo.user.WorkerLevelHistoryVO;
import lombok.NonNull;

import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;

public class WorkerLevelHistory {
    private Integer id;

    private Date time;

    private Integer workerLevel;

    private Integer userId;

    private Date startTime;

    private Date endTime;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public Integer getWorkerLevel() {
        return workerLevel;
    }

    public void setWorkerLevel(Integer workerLevel) {
        this.workerLevel = workerLevel;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public WorkerLevelHistory(@NonNull WorkerLevelHistoryVO workerLevelHistory){
        id=workerLevelHistory.getId();
        time=workerLevelHistory.getTime();
        workerLevel=workerLevelHistory.getWorkerLevel();
        SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        startTime=df.parse(workerLevelHistory.getDuration().get(0),new ParsePosition(0));
        endTime=df.parse(workerLevelHistory.getDuration().get(1),new ParsePosition(0));
    }
}